#include"Tcpserver.hpp"
#include"protocol.hpp"
#include"ServerCal.hpp"

int main()
{
    //序列化之后为 "9/n123 + 456/n"
    // Request req(123, 456, '+'); 
    // string s;
    // req.serialize(&s);
    // s = Encode(s);


    // //反序列化 //反序列化之后为123 + 456 
    // string content;
    // bool r = Decode(s, &content);
    
    // cout << content << endl;
    
    // Request temp;
    // temp.deserialize(content);

    // cout << temp.x << endl;
    // cout << temp.op << endl;
    // cout << temp.y << endl;


    //服务相应对象
    ServerCal cal;

    //tcp服务
    TcpServer * tsp = new TcpServer(8080, std::bind(&ServerCal::Calculator, &cal, std::placeholders::_1));
    tsp->InitServer();
    tsp->start();

    return 0;
}